package com.tarena.lbs.activity.dao.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.tarena.lbs.activity.dao.mapper.ActivityMapper;
import com.tarena.lbs.activity.dao.repository.ActivityRepository;
import com.tarena.lbs.activity.pojo.param.ActivityAddParam;
import com.tarena.lbs.activity.pojo.po.ActivityPO;
import com.tarena.lbs.activity.pojo.query.ActivityQuery;
import com.tarena.lbs.activity.pojo.vo.ActivityVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Slf4j
@Repository
public class ActivityRepositoryImpl implements ActivityRepository {
    @Autowired
    ActivityMapper  activityMapper;

    @Override
    public void saveActivity(ActivityPO activityPO) {
        log.debug("活动保存,repository层");
        activityMapper.insert(activityPO);
    }

    @Override
    public ActivityPO getById(Integer id) {
        log.debug("查询活动详情,repository层");
        return activityMapper.selectById(id);
    }

    @Override
    public List<ActivityPO> list(ActivityQuery  query) {
        List<ActivityPO> list = activityMapper.list(query);
        return list;
    }

    @Override
    public void updateStatus(ActivityPO po) {
        activityMapper.updateById(po);

    }

    @Override
    public void deleteById(Integer id) {
        activityMapper.deleteById(id);
    }


}
